//
//  RetrievePassword2VC.m
//  phmall
//
//  Created by admin on 2017/10/13.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "RetrievePassword2VC.h"

@interface RetrievePassword2VC ()<UITextFieldDelegate>{
    UITextField *passWord;
    UITextField *newPassWord;
}

@end

@implementation RetrievePassword2VC
-(void)rightBarAction{
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [[UINavigationBar appearance]setBarTintColor:[UIColor whiteColor]];
    UIBarButtonItem *rightBar=[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"帮助中心"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(rightBarAction)];
    self.navigationItem.rightBarButtonItem=rightBar;
    
    UIBarButtonItem *leftBar=[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"返回-1"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(leftBarAction)];
    self.navigationItem.leftBarButtonItem=leftBar;
    
    UIImageView *logo=[[UIImageView alloc]init];
    [self.view addSubview:logo];

    logo.image=[UIImage imageNamed:@"logo"];
    ViewBorderRadius(logo, 10, 0, [UIColor whiteColor]);
    [logo mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).with.offset((218-RectStatus.size.height-44-64));
        make.centerX.equalTo(self.view);
        make.width.height.offset(70);
        make.height.equalTo(logo.mas_width);
    }];

    passWord=[[UITextField alloc]init];

    passWord.placeholder=@"新的密码";
    passWord.font=[UIFont systemFontOfSize:18];
    [self.view addSubview:passWord];
    [passWord mas_updateConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).with.offset(30);
        make.right.equalTo(self.view.mas_right).with.offset(-60);
        make.top.equalTo(logo.mas_bottom).with.offset(20);
        make.height.offset(40);
    }];
    //        [name addTarget:self action:@selector(textField1TextChange:) forControlEvents:UIControlEventEditingChanged];

    UIView *passWordLine=[[UILabel alloc]init];
    [self.view addSubview:passWordLine];
    passWordLine.backgroundColor=[UIColor orangeColor];
    [passWordLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(passWord.mas_bottom);
        make.right.equalTo(self.view.mas_right).with.offset(-20);
        make.left.equalTo(self.view).with.offset(20);
        make.height.offset(1);
    }];

    newPassWord=[[UITextField alloc]init];
    newPassWord.placeholder=@"确认密码";
    newPassWord.delegate=self;
    newPassWord.font=[UIFont systemFontOfSize:18];
    newPassWord.secureTextEntry = YES;
    [self.view addSubview:newPassWord];
    newPassWord.keyboardType=UIKeyboardTypeASCIICapable;
    [newPassWord mas_updateConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).with.offset(30);
        make.right.equalTo(self.view.mas_right).with.offset(-60);
        make.top.equalTo(passWord.mas_bottom).with.offset(30);
        make.height.offset(40);
    }];

    UIView *newPassWordLine=[[UILabel alloc]init];
    [self.view addSubview:newPassWordLine];
    newPassWordLine.backgroundColor=[UIColor orangeColor];
    [newPassWordLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(newPassWord.mas_bottom);
        make.right.equalTo(self.view.mas_right).with.offset(-20);
        make.left.equalTo(self.view).with.offset(20);
        make.height.offset(1);
    }];

    UIButton *confirm=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:confirm];
    [confirm setBackgroundImage:[UIImage imageNamed:@"背景渐变条"] forState:UIControlStateNormal];
    [confirm setTitle:@"确认修改" forState:UIControlStateNormal];
    [confirm addTarget:self action:@selector(confirmAction) forControlEvents:UIControlEventTouchUpInside];
    [confirm setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    //    login.backgroundColor=[UIColor colorWithHexString:@"#ff9300"];
    //    ViewBorderRadius(login, 5, 1, [UIColor colorWithHexString:@"#ff9300"]);
    [confirm mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(newPassWordLine.mas_bottom).with.offset(50);
        make.height.offset(44);
        make.left.equalTo(self.view).with.offset(20);
        make.right.equalTo(self.view.mas_right).with.offset(-20);
    }];
    // Do any additional setup after loading the view.
}
- (void)confirmAction{
//    [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_LOGINCHANGE object:@YES];
    [self dismissViewControllerAnimated:YES completion:nil];
    RetrievePassword2VC *login=[[RetrievePassword2VC alloc]init];
    [self.navigationController pushViewController:login animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
